/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package A1;

/**
 *
 * @author Mary Llenos
 * TrafficLight class contains positions of traffic lights for the vertical
 * and horizontal streets, plus the values for each signal
 * <p>
 * The different signals are G for green(GO), O for orange(CAUTION) and
 * R for red(STOP)
 *
 */
public class TrafficLight {

    private char signal1;
    private char signal2;
    private char signal3;
    private int row;
    private int col;
    private int cPos;

    /**
     * Default constructor of TrafficLight to initialize the 3 signals of
     * the traffic light
     */
    public TrafficLight() {
        signal1 = 'G';
        signal2 = 'O';
        signal3 = 'R';
    }

    /**
     * Sets the first signal of traffic light
     *
     * @param new first signal
     */
    public void setSignal1(char signal1){
        this.signal1 = signal1;
    }

    /**
     * Sets the second signal of traffic light
     *
     * @param new second signal
     */
    public void setSignal2(char signal2){
        this.signal2 = signal2;
    }

    /**
     * Sets the third signal of traffic light
     *
     * @param new third signal
     */
    public void setSignal3(char signal3){
        this.signal3 = signal3;
    }

    /**
     * Returns the first signal of traffic light
     *
     * @return char
     */
    public char getSignal1(){
        return signal1;
    }

    /**
     * Returns the second signal of traffic light
     *
     * @return char
     */
    public char getSignal2(){
        return signal2;
    }

    /**
     * Returns the third signal of traffic light
     *
     * @return char
     */
    public char getSignal3(){
        return signal3;
    }

    /**
     * Returns row position of traffic light 
     *
     * @return int
     */
    public int getRow(){
        return row;
    }

    /**
     * Sets the row position of traffic light
     *
     * @param new row position
     */
    public void setRow(int row){
        this.row = row;
    }

    /**
     * Returns the column position of traffic light space
     *
     * @return int
     */
    public int getCol(){  
        return col;
    }

    /**
     * Sets the first column position of traffic light space
     *
     * @param new column position
     */
    public void setCol(int col){
        this.col = col;
    }

    /**
     * Sets the (x,y) position traffic light signal
     *
     * @param row position
     * @param column position
     */
    public void setPos(int row, int cPos){
        this.row = row;
        this.cPos = cPos;
    }

    /**
     * Returns the current column position of the traffic light signal
     *
     * @return int
     */
    public int getCPos(){
        return cPos;
    }

    /**
     * Swaps the values of first signal and third signal
     */
    public void changeSignal(){
        char temp = getSignal1();
        setSignal1(getSignal3());
        setSignal3(temp);
    }  
}
